'''
Author: @zhyy
Date: 2021-01-31 14:10:30
LastEditors: @zhyy
LastEditTime: 2021-02-01 20:06:06
'''
from app.models.model import User,Article,ArticleSort,Role
from app import ma
from marshmallow_sqlalchemy import ModelSchema


class ArticleSortchema(ModelSchema):
    class Meta:
        model =  ArticleSort
        load_instance = True

class Rolechema(ModelSchema):
    class Meta:
        model =  Role
        load_instance = True


class Userchema(ma.SQLAlchemyAutoSchema):
    role = ma.Nested(Rolechema, many=True)
    class Meta:
        model =  User
        load_instance = True

# class Articlechema(ModelSchema):
#     class Meta:
#         model = ArticleSort